#ifndef _MUTELXLOCK_H_
#define _MUTELXLOCK_H_

#include <pthread.h>
#include "Noncopyable.h"
#include <iostream>

using std::cout;
using std::endl;

class MutexLock : public Noncopyable
{
    public:
        MutexLock();
        ~MutexLock();

        void lock();
        void unlock();

        pthread_mutex_t* getMutexLockPtr();
    private:
        pthread_mutex_t _mutex; 
		bool _isLocking;
};

class MutexLockGuard
{
    public:
        MutexLockGuard(MutexLock& mutex)
            :_mutex(mutex)
        {
            _mutex.lock();
        }
        ~MutexLockGuard()
        {
            _mutex.unlock();
        }
    private:
        MutexLock& _mutex;
};

#endif
